//
//  FirstViewController.m
//  EMultiNavigation
//
//  Created by EasonWang on 13-11-5.
//  Copyright (c) 2013年 EasonWang. All rights reserved.
//

#import "FirstViewController.h"
#import "EMImageViewer.h"
#import "EMView.h"
@interface FirstViewController ()
{
    NSMutableArray *_imageViewArray;
    UIImage *_image;
    EMView *_view;
}
@end

@implementation FirstViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        
    }
    return self;
}
-(void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    _imageViewArray = [[NSMutableArray alloc]initWithCapacity:0];
    
    _scrollView.contentSize = CGSizeMake(320, 1000);
    
    _image = [UIImage imageNamed:@"IMG_0618.JPG"];
    [_imageView setImage:_image];
    
    [_imageViewArray addObject:_image];
    [_imageView setupImageViewerWithDataSource:self initialIndex:0 onOpen:^{
        NSLog(@"open");
    } onClose:^{
        NSLog(@"close");
    }];
    
    
    _image = [UIImage imageNamed:@"0_iphone.png"];
    [_imageView2 setImage:_image];
    [_imageViewArray addObject:_image];
    [_imageView2 setupImageViewerWithDataSource:self initialIndex:1 onOpen:^{
        NSLog(@"_imageView2 open");
    } onClose:^{
        NSLog(@"_imageView2 close");
    }];
    

    _image = [UIImage imageNamed:@"IMG_0446.JPG"];
    _imageView3.image = _image;
    [_imageViewArray addObject:_image];
    [_imageView3 setupImageViewerWithDataSource:self initialIndex:2 onOpen:^{
        NSLog(@"_imageView3 open");
    } onClose:^{
        NSLog(@"_imageView3 close");
    }];
    
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


#pragma mark - EMImageViewerDelegate

-(NSInteger)numberImagesFromImageViewer:(EMImageViewer *)imageViewer
{
    return _imageViewArray.count;
}
-(UIImage *)getImageFromDatasource:(UIImage *)image
{
    return _image;
}
-(NSMutableArray *)getImageViewArray
{
    return _imageViewArray;
}
@end
